<!--# layout("/common/layout.html",{"jsBase":"/js/tDEnrolledData/major/"}){ -->
<form class="layui-form layui-form-pane" id="addForm"  lay-filter="editform">
    <input type="hidden" name="id" id="id">
    <input type="hidden" name="pId" id="pId" value="${pId}">
    <input type="hidden" name="provinceId" id="provinceId" value="${provinceId}">
    <br>

    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">专业名称</label>
                <div class="layui-input-inline">
                    <input type="text" name="majorName" id="majorName" autocomplete="off" maxlength="50" class="layui-input" >
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">专业代码</label>
                <div class="layui-input-inline">
                    <input type="text" name="majorCode" id="majorCode" autocomplete="off" maxlength="50" class="layui-input" >
                </div>
            </div>
        </div>
    </div>

    <div class="layui-row">
        <div class="layui-form-item">
            <div class="layui-inline">
                <label class="layui-form-label">录取</label>
                <div class="layui-input-inline">
                    <input type="text" name="enrolled" id="enrolled" autocomplete="off" maxlength="50" class="layui-input" >
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">最低分</label>
                <div class="layui-input-inline">
                    <input type="text" name="lowScore" id="lowScore" autocomplete="off" maxlength="50" class="layui-input" >
                </div>
            </div>
        </div>

    </div>
    <div class="layui-row">
        <div class="layui-form-item">

            <div class="layui-inline">
                <label class="layui-form-label">平均分</label>
                <div class="layui-input-inline">
                    <input type="text" name="averageScore" id="averageScore" autocomplete="off" maxlength="50" class="layui-input" >
                </div>
            </div>
            <div class="layui-inline">
                <label class="layui-form-label">最高分</label>
                <div class="layui-input-inline">
                    <input type="text" name="highScore" id="highScore" autocomplete="off" maxlength="50" class="layui-input" >
                </div>
            </div>
        </div>
    </div>

    <layui:submitButtons id="majoraddButton" />
</form>
<!--#} -->
<script>
layui.extend({
    loading: '../../../plugins/layui_extends/loading/loading',
}).define([ 'form', 'laydate', 'table','loading','majorApi'], function(exports) {
    var form = layui.form;
    var majorApi = layui.majorApi;
    var index = layui.index;
    var isNew = true;
    <!--# if(!(isEmpty(tdEnrolledDataJson))){  -->
    isNew = false;
    <!--# } -->

    var view = {
        init:function(){
            Lib.initGenrealForm($("#addForm"),form);
            this.initSubmit();
        },
        initSubmit:function(){
            $("#majoraddButton").click(function(){
                // $("#addButton").hide();
                // $("#addButton-loading").show();
                // $("#addButton-loading").loading();
                form.on('submit(form)', function(){
                    majorApi.saveForm(isNew,$('#addForm'),function(){
                        parent.window.dataReload();
                        Common.info("保存成功");
                        Lib.closeFrame();
                    });
                });
            });

            $("#majoraddButton-cancel").click(function(){
                Lib.closeFrame();
            });
        }

    }
    view.init();

    <!--# if(!(isEmpty(tdEnrolledDataJson))){  -->
    var formJson = ${tdEnrolledDataJson};
    form.val("editform",formJson);
    <!--# } -->

});
</script>
